import Vue from 'vue'
import { Swipe, SwipeItem, Lazyload, Popup, GoodsAction, GoodsActionButton } from 'vant'
import { MessageBox, Toast, Indicator } from 'mint-ui'
Vue.use(Swipe)
Vue.use(SwipeItem)
Vue.use(Lazyload)
Vue.use(Popup)
Vue.use(GoodsAction)
Vue.use(GoodsActionButton)
Vue.use(MessageBox)
Vue.use(Toast)
Vue.use(Indicator)
export default {
  data () {
    return {
      // 轮播
      params: {},
      bannners: '',
      list: [
        'https://res.bestcake.com/m-images/jd-detail/莱茵河莓妖精/莱茵河莓妖精-1.jpg',
        'https://res.bestcake.com/m-images/jd-detail/莱茵河莓妖精/莱茵河莓妖精-2.jpg',
        'https://res.bestcake.com/m-images/jd-detail/莱茵河莓妖精/莱茵河莓妖精-3.jpg',
        'https://res.bestcake.com/m-images/jd-detail/莱茵河莓妖精/莱茵河莓妖精-4.jpg'
      ],
      //  满足地区的商品信息
      types: [
        { Size: '1镑' }
        // { Size: '2镑' },
        // { Size: '3镑' },
        // { Size: '4镑' }
      ],
      //  商品价格
      informa: {},
      isLoad: false,
      //  当前选中规格
      currentType: {},
      //  架构数量
      num: 1,
      //  当前选中规格信息
      ProductConfig: [],
      // 购买
      show: false
    }
  },
  mounted () {
  },
  methods: {
  // 改变路径
    toPath () {
      window.location.href = '/store#/goods'
    },
    userSelct () {
      window.location.href = '/store#/goods'
    },
    // 加入购物车
    addcart () {
      MessageBox.confirm('确认加入购物车?').then(action => {
        window.location.href = '/store#/cart'
        Toast({
          message: '加购成功,即将进入购物车',
          iconClass: 'icon icon-success',
          duration: 1000
        })
      }).catch(() => {
      })
      setTimeout(() => {
      }, 3000)
    },
    // 购买
    gonow () {
      Indicator.open('Loading...')
      setTimeout(() => {
        Indicator.close()
        MessageBox('抱歉', '抱歉购买失败，请重新购买')
      }, 2000)
    },
    // 加
    add () {
      this.num++
    },
    // 减
    cut () {
      if (this.num > 1) {
        this.num--
      } else {
        this.num = 1
      }
    },
    // 评价点击提示信息
    showPopup () {
      this.show = true
    }
  }
}
